<?php
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
 
class b2c_finder_member_zong{ 
    public function __construct($app)
    {
        // $this->controller = app::get('b2c')->controller('admin_member');
        // $this->column_control = app::get('b2c')->_('EMAIL');
        $this->controller = app::get('b2c')->controller('admin_member_zong');
    }

    var $column_money = '欠款';
    public function column_money($row){
        $yuzhi = $row['yuzhi'];
        $member = app::get('b2c')->model('members');
        $member_id = $row['member_id'];
        $memberMsg = $member->dump($member_id,'advance');
        if($memberMsg['advance']['total'] < $yuzhi){
            return $yuzhi-$memberMsg['advance']['total'];
        }else{
            return '--';
        }
    }

    var $column_control = '实际预存款';
    public function column_control($row){
        // dump($row);exit;
        $member = app::get('b2c')->model('members');
        $member_id = $row['member_id'];
        $big_credit = $row['yuzhi'];
        $memberMsg = $member->dump($member_id,'advance');
        if($memberMsg['advance']['total'] > $big_credit){
            $real['total'] = $memberMsg['advance']['total'] - $big_credit;//实际预存款，用总预存款减去，信用额度阈值 qianjin 2016-9-2
            return '￥'.$real['total'];
        }else{
            return '￥0.00';    
        }
    }

    var $column_use = '可用额度';
    public function column_use($row){
        $member = app::get('b2c')->model('members');
        $member_id = $row['member_id'];
        $memberMsg = $member->dump($member_id,'advance');
        return '￥'.$memberMsg['advance']['total'];
    }
}
?>